import { Component } from "@angular/core"
import { NavParams} from 'ionic-angular';

import { AppConfig } from '../../app/app.config';

import { HttpClient } from '@angular/common/http';
import { NativeStorage } from '@ionic-native/native-storage';
import { TranslateService } from '@ngx-translate/core'
@Component({
    selector: 'page-set',
    templateUrl: 'review.html',
})

export class ReviewPage{
    token:any;
    id:string;
    list:any
    constructor(
        private http:HttpClient,
        private storage: NativeStorage,
        private navParams:NavParams,
        private translate: TranslateService,
    ) {
        translate.setDefaultLang('en');
        this.id = this.navParams.get('id')
        this.storage.getItem('token').then(token=>{
            this.token = token   
        })
    }
    ionViewDidEnter(){
        this.storage.getItem('lang').then(res=>{
            this.translate.use(res)
        })
        this.http.get(AppConfig.getUrl()+'Cart/getComments?token='+this.token+'&cid='+this.id)
        .subscribe( res => {
            if(res['code']===101){
                this.list = res['data']['rows']
            }
        })
    }
}